<html>
<head>
     <link rel="shortcut icon" type="image/x-icon" href="<?php echo base_url()?>application/images/favicon.ico">
     <title>Vevive</title>
    <!--[if gte IE 7]>
        <link href="<?php echo base_url();?>application/css/ie.css" type="text/css" rel="stylesheet" />
    <![endif]-->
    <!--[if IE 7]>
        <link href="<?php echo base_url();?>application/css/ie7.css" type="text/css" rel="stylesheet" />
    <![endif]-->
    <link href="<?php echo base_url()?>/application/css/common.css" rel="stylesheet" type="text/css" />
    <link href="<?php echo base_url()?>/application/css/profile.css" rel="stylesheet" type="text/css" />
    <link href="<?php echo base_url(); ?>application/js/jquery-ui-1.8.16/css/redmond/jquery-ui-1.8.16.custom.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="<?php echo base_url(); ?>application/js/jquery-ui-1.8.16/js/jquery-1.6.2.min.js" ></script>
    <script type="text/javascript" src ="<?php echo base_url(); ?>application/js/jquery-ui-1.8.16/js/jquery-ui-1.8.16.custom.min.js "></script>
    <script src="<?php echo base_url();?>application/js/global.js" type="text/javascript"></script>
    <script type="text/javascript" src="<?php echo base_url();?>application/js/loader.js"></script>
    <?php
        $firstEventName='';
        $firstEventDesc='';
        $firstEid='';
        $uid=$userData['userId'];
        $checked="";
        $hasIcon="0";
        $userImagePath="";
        if(key_exists("hasIcon", $userData)){
            $hasIcon=$userData['hasIcon'];
        }
        if(key_exists("datastorePath",$userData)){
            $userImagePath=$userData['datastorePath'];
        }
        ?>
</head>
<body>
    <div class="contentWrapper">
        <?php
         $include="html/application/templates/nav.php";
         $includeFooter="html/application/templates/footer.php";
         $imageModal ="html/application/templates/uploadImageModal.php";
         $userProfileModal="html/application/templates/userProfileModal.php";
         $paymentModal="html/application/templates/paymentModal.php";
         $disclaimerModal="html/application/templates/disclaimerModal.php";
         $editEventModal="html/application/templates/editEventModal.php";
        if(strpos($_SERVER['HTTP_HOST'],"localhost")===false){
            $include="/application/templates/nav.php";
            $includeFooter="/application/templates/footer.php";
            $imageModal ="/application/templates/uploadImageModal.php";
            $userProfileModal="/application/templates/userProfileModal.php";
            $paymentModal="/application/templates/paymentModal.php";
            $disclaimerModal="/application/templates/disclaimerModal.php";
            $editEventModal="/application/templates/editEventModal.php";
            
        }
        include_once $_SERVER['DOCUMENT_ROOT'].$include;
        ?>
        <div class="userInfomationBox">
            <div class="photoFrame">
                <?php if($hasIcon=="0"){?>
                    <img src="<?php echo base_url();?>application/images/unknown_user.gif" alt="user image" />
                <?php }else{  ?>
                    <img src="<?php echo base_url();?>application/datastore/<?php echo $userImagePath; ?>/userProfileImage.jpg" />
                <?php } ?>
            </div>
            <div class="userInformationArea">
                        <ul>
                            <li class="label">Name:</li>
                            <li class="listdesc"><?php echo $userData['fName'].' '.$userData['lName'];?></li>
                        </ul>
                        <ul>
                            <li class="label">Location:</li>
                            <li class="listdesc"><?php echo $userData['userCity'].', '.$userData['userState'];?></li>
                        </ul>
                        <ul>
                            <li class="label">Interest:</li>
                            <li class="listdesc"><?php echo $userData['userInterest'];?></li>
                        </ul>
                        <ul class="biolist">
                            <li class="label">Bio:</li>
                            <li class="listdesc"><span><?php echo $userData['userBio']; ?></span></li>
                       </ul>
            </div>
            
                    <ul class="list functionsList">
                        <li><a href="javascript:editProfile();">edit profile</a></li>
                        <li><a href="javascript:editProfilePic();">edit profile pic</a></li>
                        <li><a href="javascript:editUserEvent(true);">edit my event</a></li>
                    </ul>
            
        </div><!-- end of user information area-->
        <div class="eventWrapper">
           <div class="upcoming left">
            <div class="upcomingTitle">UPCOMING EVENTS</div>
            <?php foreach($events as $key => $evt){
                $location = $evt->city.', '.$evt->state;
                $date = date("F l \\t\h\e jS Y g:i:s A",  strtotime($evt->tStamp));
                $cost=number_format($evt->cost, 2, '.', '');
                if($key==0){
                    $firstEventDesc=$evt->eDesc;
                    $firstEventName=$evt->eName;
                    $firstEid=$evt->eid;
			
                    if(in_array($firstEid,$uReg) ){
                        // this mean the first event on the screen user has join
                        $checked="checked disabled=disabled";
                    }
                }
                ?>
                <div class="eventbox bindEventBoxes" id="event-<?php echo $evt->eid?>">
                    <div class="imageHolder">
                        <?php if($hasIcon=="0"){?>
                            <img alt="image" src="<?php echo base_url()?>application/images/placeholder.jpg" />
                        <?php }else{?>
                            <img alt="image" src="<?php echo base_url()?>application/<?php echo $userImagePath;?>/userProfileImage.jpg" />
                        <?php }?>
                    </div>
                    <div class="eventData">
                        <ul class="large">
                            <li class="tag">Event Name:</li>
                            <li id="eventboxName"><?php echo $evt->eName; ?></li>
                        </ul>

                        <ul class="medium">
                            <li class="tag">Event Date:</li>
                            <li><?php echo $date; ?></li>
                        </ul>

                        <ul class="medium">
                            <li class="tag">Event Location:</li>
                            <li><?php echo $location; ?></li>
                        </ul>
                    </div>
                    <input type="hidden" value="<?php echo $evt->eDesc;?>" name="eventboxdesc" />
                    <input type="hidden" value="<?php echo $cost;?>" name="cost" />
                    <input type="hidden" value="<?php echo (in_array($evt->eid,$uReg))?1:0 ?>" name="isJoin" />
                </div><!-- end of eventbox-->
            <?php } ?>
           </div> <!-- end of upcoming -->
        
           
            <div class="individuale">
                <div class="evtname" id="curEvtName"><?php echo $firstEventName; ?></div>
                <div class="evtnav" id="curEvtDesc"><?php echo $firstEventDesc; ?></div>

                <div class="joinFunction">
                   <form method="POST" onsubmit="return formIntegrity(this);" action="<?php echo base_url();?>/profile/processEvents">
                    <ul>
                        <li><input type="checkbox" name="wish" disabled="disabled"  /></li>
                        <li>Save to My Wish List</li>
                    </ul>
                    <ul>
                        <li><input type="checkbox" name="join" <?php echo $checked;?> customtype="switch" /></li>
                        <li>Join this Event</li>
                    </ul>
                    <div class="joinSubmit">
                        <input type="submit" value="Submit" />
                    </div>
                       <input type="hidden" value="<?php echo $firstEid;?>" name="eid" id="hiddenEid" />
                       <input type="hidden" value="<?php echo $uid; ?>" name="uid" />
                   </form>
                </div>
            </div><!-- end of individual event -->

        </div>
         <?php include_once $_SERVER['DOCUMENT_ROOT'].$includeFooter;?>
    </div>
    <?php
        include_once $_SERVER['DOCUMENT_ROOT'].$editEventModal;
        include_once $_SERVER['DOCUMENT_ROOT'].$disclaimerModal;
        include_once $_SERVER['DOCUMENT_ROOT'].$userProfileModal;
        include_once $_SERVER['DOCUMENT_ROOT'].$paymentModal;
        include_once $_SERVER['DOCUMENT_ROOT'].$imageModal;
    ?>
</body> 
</html>
